package cn.iocoder.yudao.module.statistics.enums;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 提现状态的枚举
 *
 * @author owen
 */
@AllArgsConstructor
@Getter
public enum CashOutStatusEnum implements IntArrayValuable {

    // 0-待审核；1-待打款；2-提现成功；-1-提现成功；
    PENDING_APPROVAL(0, "待审核"),
    AUDIT_PASS(1, "待打款"),
    CASH_OUT_SUCCESS(2, "提现成功"),
    AUDIT_REJECT(-1, "审核驳回"),
    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CashOutStatusEnum::getStatus).toArray();

    public static String getNameByStatus(Integer status) {
        CashOutStatusEnum typeEnum = CollUtil.findOne(CollUtil.newArrayList(CashOutStatusEnum.values()),
                item -> ObjUtil.equal(item.getStatus(), status));
        return typeEnum == null ? null : typeEnum.getName();
    }
    /**
     * 值
     */
    private final Integer status;
    /**
     * 名字
     */
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

}
